package com.rgsx.service.serviceImpl;

import com.alibaba.fastjson.JSONObject;
import com.rgsx.service.FunService;
import com.rgsx.utils.HttpUtil;
import com.rgsx.vo.ResultVo;
import org.springframework.stereotype.Service;

import java.util.HashMap;

@Service
public class FunServiceImpl implements FunService {


    @Override
    public ResultVo chat(String msg) {
        HashMap<String, String> map = new HashMap<>();
        map.put("key","free");
        map.put("appid","0");
        map.put("msg",msg);

        try {
            JSONObject jsonObject = HttpUtil.doGet("http://api.qingyunke.com/api.php", map);
            return ResultVo.success("成功",jsonObject);
        } catch (Exception e) {
            return ResultVo.fail(e);
        }
    }
}
